import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {
  Modal,
  Button,
  Select,
  TextArea,
} from '@folio/stripes/components';
import { Field, reduxForm } from 'redux-form';
import { FormattedMessage  } from 'react-intl';
import {  injectIntl } from 'react-intl';
import { stripesConnect } from '@folio/stripes/core';
class approval extends Component {
  constructor(props) {
    super(props);
    this.state={
       state:"1"
    }
  }
  static PropTypes ={
    isOpen:PropTypes.bool,
    closeModal:PropTypes.func,
    commitApproval:PropTypes.func,
    intl:PropTypes.object
  }
  

  render() {
    const {isOpen,closeModal,commitApproval,handleSubmit,intl} = this.props
   
    return (
      < Modal dismissible
      closeOnBackgroundClick
      label={<FormattedMessage id={"ui-party.loans.columns.operating.approval"}></FormattedMessage>}
      open={isOpen} onClose={closeModal}
 
      >
     <form data-test-form-page id="form-search" onSubmit={handleSubmit} style={{textAlign:'right'}}>
     <Field
       label={
        <FormattedMessage id="ui-party.loans.columns.party.approvalStatus" />
      }
       component={Select}
       name="state"
       required
       dataOptions={[
                  {
                      id: '1',
                      value: '1',
                      label: intl.formatMessage({ id: 'ui-party.other.approved' })
                    },
                    {
                      id: '2',
                      value: '2',
                      label: intl.formatMessage({ id: 'ui-party.other.unapproved' })
                    }
                  ]}
                />
          <Field
              component={TextArea}
              name="remark"
              label={
                <FormattedMessage id="ui-party.loans.columns.property.remark" />
              }
              style={{ height: '150px' }}
            />     
           <Button type="submit" >  <FormattedMessage id="ui-party.saveAndExit" /></Button> 
    </form>
      </Modal>
    );
  }
}
export default stripesConnect(injectIntl(
  reduxForm({
    form: 'appraisalApprovalFrom',
    navigationCheck: true,
    enableReinitialize: true
  })(approval))
);
 